//
//  XCListenMusicTableViewCell.m
//  SoundOfNature
//
//  Created by 梁新昌 on 16/3/14.
//  Copyright © 2016年 梁新昌. All rights reserved.
//

#import "XCListenMusicTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation XCListenMusicTableViewCell
- (void)dealloc {
    [_headImageView release];
    [_nameLable release];
    [_singerNameLable release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.headImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.nameLable = [[UILabel alloc] initWithFrame:CGRectZero];
        self.singerNameLable = [[UILabel alloc] initWithFrame:CGRectZero];
        
        [self.contentView addSubview:self.headImageView];
        [self.contentView addSubview:self.nameLable];
        [self.contentView addSubview:self.singerNameLable];
        
        [self.headImageView release];
        [self.nameLable release];
        [self.singerNameLable release];
        
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.headImageView.frame = CGRectMake(10, 5, self.bounds.size.width / 5, self.bounds.size.width / 5);
    self.nameLable.frame = CGRectMake(self.headImageView.frame.size.width + self.headImageView.frame.origin.x + 15, 10, self.frame.size.width / 3, 21);
    self.nameLable.font = [UIFont systemFontOfSize:15];
    self.nameLable.textColor = [UIColor colorWithWhite:0.902 alpha:1.000];
    self.singerNameLable.frame = CGRectMake(self.nameLable.frame.origin.x, self.nameLable.frame.size.height + 15, self.bounds.size.width, 21);
    self.singerNameLable.font = [UIFont systemFontOfSize:13];
    self.singerNameLable.textColor = [UIColor colorWithWhite:0.800 alpha:1.000];
}
- (void)setSongListModel:(XCSongListModel *)songListModel {
    if (_songListModel != songListModel) {
        [_songListModel release];
        _songListModel = [songListModel retain];
    }
    self.nameLable.text = songListModel.name;
    self.singerNameLable.text = songListModel.singerName;
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:songListModel.picUrl]placeholderImage:[UIImage imageNamed:@"Image-p"]];
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
